<?php

class API {

    private $iLimit;
    private $sOrder;

    // constructor
    public function API() {
        $this->iLimit = 5;
        $this->sOrder = 'last';
    }

    // set method
    public function setMethod($s) {
        $this->sMethod = $s;  
    }

    // set limit
    public function setLimit($i) {
        $this->iLimit = ($i > 0 && $i < 10) ? $i : $this->iLimit;
    }

    // set order
    public function setOrder($s) {
        $this->sOrder = $s;  
    }

    // return list of videos
    public function getAllParking() {
        
        $aData = $GLOBALS['MySQL']->getAll("SELECT IF(parking.id <10,CONCAT('Park0',parking.id),CONCAT('Park',parking.id)) ParkId,CONCAT(parking.number,',',parking.street,',',parking.district,',',parking.city ) Address ,parking.parking_name ParkName,parking.latitude Latitude, parking.longitude Longtitude, parking.num_blank Status FROM parking");
	  if (count($aData)) {
				echo json_encode(array('data' => $aData));
			} else {
				echo json_encode(array('data' => 'Nothing found'));
			}
        // output in necessary format
        
    }
}